// Copyright 2022 a.o.smith ALL Rights Reserved
package com.liuxinlong.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 专利状态类型枚举
 *
 * @author liuxinlong@hotwater.com.cn
 * @version 1.0.0
 * @since 2024-05-10
 */
public enum PatentStatusTypeEnum {
    REVIEW(1, "官方审查"),
    EMPOWER(2, "授权"),
    EXPIRE(3, "失效");

    private int value;

    private String name;

    PatentStatusTypeEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public static String getNameByValue(int value) {
        PatentStatusTypeEnum arrObj[] = PatentStatusTypeEnum.values();
        for (PatentStatusTypeEnum obj : arrObj) {
            if (value == obj.getValue()) {
                return obj.getName();
            }
        }
        return "未知状态";
    }

    public static int getValueByName(String name) {
        PatentStatusTypeEnum arrObj[] = PatentStatusTypeEnum.values();
        for (PatentStatusTypeEnum obj : arrObj) {
            if (StringUtils.equals(name,obj.getName())) {
                return obj.getValue();
            }
        }
        return 0;
    }
}
